package com.party.core.service.commune.impl;

import com.party.common.paging.Page;
import com.party.core.dao.read.commune.CDataAnalysisCountReadDao;
import com.party.core.dao.write.commune.CDataAnalysisCountWriteDao;
import com.party.core.model.BaseModel;
import com.party.core.model.commune.CDataAnalysisCount;
import com.party.core.model.commune.CDataAnalysisCountOutput;
import com.party.core.service.commune.ICDataAnalysisCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;


@Service
public class CDataAnalysisCountService implements ICDataAnalysisCountService {
    @Autowired
    private CDataAnalysisCountReadDao cDataAnalysisCountReadDao;
    @Autowired
    private CDataAnalysisCountWriteDao cDataAnalysisCountWriteDao;

    @Override
    public String insert(CDataAnalysisCount cDataAnalysisCount) {
        BaseModel.preInsert(cDataAnalysisCount);
        boolean result = cDataAnalysisCountWriteDao.insert(cDataAnalysisCount);
        if (result) {
            return cDataAnalysisCount.getId();
        }
        return null;
    }

    @Override
    public boolean update(CDataAnalysisCount cDataAnalysisCount) {
         cDataAnalysisCount.setUpdateDate(new Date());
        return cDataAnalysisCountWriteDao.update(cDataAnalysisCount);
    }

    @Override
    public boolean deleteLogic(String id) {
        return false;
    }

    @Override
    public boolean delete(String id) {
        return cDataAnalysisCountWriteDao.delete(id);
    }

    @Override
    public boolean batchDeleteLogic(Set<String> ids) {
        return false;
    }

    @Override
    public boolean batchDelete(Set<String> ids) {
        return false;
    }

    @Override
    public CDataAnalysisCount get(String id) {
        return cDataAnalysisCountReadDao.get(id);
    }

    @Override
    public List<CDataAnalysisCount> listPage(CDataAnalysisCount cDataAnalysisCount, Page page) {
        return cDataAnalysisCountReadDao.listPage(cDataAnalysisCount,page);
    }

    @Override
    public List<CDataAnalysisCount> list(CDataAnalysisCount cDataAnalysisCount) {
        return cDataAnalysisCountReadDao.listPage(cDataAnalysisCount,null);
    }

    @Override
    public List<CDataAnalysisCount> batchList(Set<String> ids, CDataAnalysisCount cDataAnalysisCount, Page page) {
        return null;
    }

    @Override
    public CDataAnalysisCount getCDataAnalysisCountByMemberGroupId(String memberGroupId) {
        return cDataAnalysisCountReadDao.getCDataAnalysisCountByMemberGroupId(memberGroupId);
    }

    @Override
    public CDataAnalysisCountOutput sumOrg(Map<String, Object> params) {
        return cDataAnalysisCountReadDao.sumOrg(params);
    }

    @Override
    public List<CDataAnalysisCountOutput> sumOrgList(Map<String, Object> params) {
        return cDataAnalysisCountReadDao.sumOrgList(params);
    }
}
